package net.ib.mtalk.ui.attachment.emoticon;

import net.ib.mtalk.R;
import net.ib.mtalk.global.GlobalApplication;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;
import android.widget.EditText;
import android.widget.TextView;

/**
 * 이모티콘 표현을 위해 String을 자동 변환하는 클래스. 객체의 생성시에 이모티콘 코드를 ImageSpan으로 바꾼다.<br>
 * <br>
 * <font color=#ff0000>Caution!</font> If you {@link String#concat(String) concat()} or {@link String#concat(String) +} with normal {@link java.lang.String String},
 * then spans will be removed and the result will be a normal {@link java.lang.String String}.
 * @author Arngard
 */
public class RichString extends SpannableStringBuilder {

	public static String[] stringCode;
	public static int[] resCode;

	static {
		// There can be Various Emoji specs
		initIphoneSpec();
	}

	public static RichString buildString(String formatString) {
		return new RichString(GlobalApplication.getResource(), formatString);
	}

	public static RichString buildString(Resources res, String formatString) {
		return new RichString(res, formatString);
	}

	public static RichString buildString(String formatString, int imageSize) {
		return new RichString(GlobalApplication.getResource(), formatString, imageSize);
	}

	public static RichString buildString(Resources res, String formatString, int imageSize) {
		return new RichString(res, formatString, imageSize);
	}

	public RichString(String formatString) {
		super(formatString);

		buildRich(GlobalApplication.getResource(), formatString, -1);
	}

	public RichString(String formatString, int imageSize) {
		super(formatString);

		buildRich(GlobalApplication.getResource(), formatString, imageSize);
	}

	public RichString(Resources res, String formatString) {
		super(formatString);

		buildRich(res, formatString, -1);
	}

	public RichString(Resources res, String formatString, int imageSize) {
		super(formatString);

		buildRich(res, formatString, imageSize);
	}

	private void buildRich(Resources res, String formatString, int imageSize) {
		if (stringCode == null || resCode == null)
			return;

		ImageSpan imagespan;
		int currentCodeLenth;
		// search pointer
		int currentTextIndex;

		// variables for iteration speed
		String currentemotiCode;
		int currentemotiCodeLength;
		int currentResCode;
		for (int codeIndex = 0; codeIndex < stringCode.length; ++codeIndex) {
			currentCodeLenth = 0;

			currentemotiCode = stringCode[codeIndex];
			if (currentemotiCode == null || "".equals(currentemotiCode))
				continue;
			currentemotiCodeLength = currentemotiCode.length();
			currentResCode = resCode[codeIndex];

			currentTextIndex = 0;

			while(true)
			{
				// Search next code position in the formatString
				currentTextIndex = formatString.indexOf(currentemotiCode, currentTextIndex + currentCodeLenth);

				// Replace the stringCode with the image
				if(-1 < currentTextIndex)
				{
					currentCodeLenth = currentemotiCodeLength;
					Drawable drawable = res.getDrawable(currentResCode);
					if (imageSize < 0) {	// set icon size
						drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
					} else {
						drawable.setBounds(0, 0, imageSize, imageSize);
					}
					imagespan = new ImageSpan(drawable, ImageSpan.ALIGN_BOTTOM);
					setSpan(imagespan, currentTextIndex, currentTextIndex + currentCodeLenth, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
				}
				else
					break;
			}
		}
	}

	/**
	 * TextView에 대해, 기존에 들어있는 문자열을 이모티콘이 적용된 문자열로 대체해준다.
	 * @param textView target
	 */
	public static void enrich(TextView textView) {
		String source = textView.getText().toString();
		textView.setText(new RichString(source, (int) (textView.getLineHeight()*1.2f)));
	}

	/**
	 * EditText에 이모티콘을 한 개씩 입력하는 동작을 위한 메소드.
	 * 이미 문자열이 들어있는 editText에 문자열을 끼워 넣는다.
	 * 커서 위치에 입력된다.
	 * @param string RichString to replace cursor selection.
	 * @param editText target EditText.
	 */
	public void insertInto(EditText editText) {
		int stt = editText.getSelectionStart(); // 커서 범위 시작점 알아내기
		int end = editText.getSelectionEnd();	// 커서 범위 끝점 알아내기
		editText.getEditableText().replace(stt, end, this, 0, length());	// 범위를 대체함
		editText.setSelection(stt + length(), stt + length());	// 대체된 구간의 마지막으로 커서를 옮김.
	}

	public static int getStringCodeCount() {
		return stringCode.length;
	}

	public static String getStringCodeAt(int index) {
		return stringCode[index];
	}

	public static int getResCount() {
		return resCode.length;
	}

	public static int getResCodeAt(int index) {
		return resCode[index];
	}

	private static void initIphoneSpec() {
		initemotiCodeIphone();
		initResCodeIphone();
	}

	private static void initemotiCodeIphone() {
		int i=0;
		stringCode = new String[471];

		stringCode[i] = Character.toString((char)0xe00a); ++i;
		stringCode[i] = Character.toString((char)0xe00b); ++i;
		stringCode[i] = Character.toString((char)0xe00c); ++i;
		stringCode[i] = Character.toString((char)0xe00d); ++i;
		stringCode[i] = Character.toString((char)0xe00e); ++i;
		stringCode[i] = Character.toString((char)0xe00f); ++i;
		stringCode[i] = Character.toString((char)0xe001); ++i;
		stringCode[i] = Character.toString((char)0xe01a); ++i;
		stringCode[i] = Character.toString((char)0xe01b); ++i;
		stringCode[i] = Character.toString((char)0xe01c); ++i;
		stringCode[i] = Character.toString((char)0xe01d); ++i;
		stringCode[i] = Character.toString((char)0xe01e); ++i;
		stringCode[i] = Character.toString((char)0xe01f); ++i;
		stringCode[i] = Character.toString((char)0xe002); ++i;
		stringCode[i] = Character.toString((char)0xe02a); ++i;
		stringCode[i] = Character.toString((char)0xe02b); ++i;
		stringCode[i] = Character.toString((char)0xe02c); ++i;
		stringCode[i] = Character.toString((char)0xe02d); ++i;
		stringCode[i] = Character.toString((char)0xe02e); ++i;
		stringCode[i] = Character.toString((char)0xe02f); ++i;
		stringCode[i] = Character.toString((char)0xe003); ++i;
		stringCode[i] = Character.toString((char)0xe03a); ++i;
		stringCode[i] = Character.toString((char)0xe03b); ++i;
		stringCode[i] = Character.toString((char)0xe03c); ++i;
		stringCode[i] = Character.toString((char)0xe03d); ++i;
		stringCode[i] = Character.toString((char)0xe03e); ++i;
		stringCode[i] = Character.toString((char)0xe03f); ++i;
		stringCode[i] = Character.toString((char)0xe004); ++i;
		stringCode[i] = Character.toString((char)0xe04a); ++i;
		stringCode[i] = Character.toString((char)0xe04b); ++i;
		stringCode[i] = Character.toString((char)0xe04c); ++i;
		stringCode[i] = Character.toString((char)0xe04d); ++i;
		stringCode[i] = Character.toString((char)0xe04e); ++i;
		stringCode[i] = Character.toString((char)0xe04f); ++i;
		stringCode[i] = Character.toString((char)0xe005); ++i;
		stringCode[i] = Character.toString((char)0xe05a); ++i;
		stringCode[i] = Character.toString((char)0xe006); ++i;
		stringCode[i] = Character.toString((char)0xe007); ++i;
		stringCode[i] = Character.toString((char)0xe008); ++i;
		stringCode[i] = Character.toString((char)0xe009); ++i;
		stringCode[i] = Character.toString((char)0xe010); ++i;
		stringCode[i] = Character.toString((char)0xe10a); ++i;
		stringCode[i] = Character.toString((char)0xe10b); ++i;
		stringCode[i] = Character.toString((char)0xe10c); ++i;
		stringCode[i] = Character.toString((char)0xe10d); ++i;
		stringCode[i] = Character.toString((char)0xe10e); ++i;
		stringCode[i] = Character.toString((char)0xe10f); ++i;
		stringCode[i] = Character.toString((char)0xe011); ++i;
		stringCode[i] = Character.toString((char)0xe11a); ++i;
		stringCode[i] = Character.toString((char)0xe11b); ++i;
		stringCode[i] = Character.toString((char)0xe11c); ++i;
		stringCode[i] = Character.toString((char)0xe11d); ++i;
		stringCode[i] = Character.toString((char)0xe11e); ++i;
		stringCode[i] = Character.toString((char)0xe11f); ++i;
		stringCode[i] = Character.toString((char)0xe012); ++i;
		stringCode[i] = Character.toString((char)0xe12a); ++i;
		stringCode[i] = Character.toString((char)0xe12b); ++i;
		stringCode[i] = Character.toString((char)0xe12c); ++i;
		stringCode[i] = Character.toString((char)0xe12d); ++i;
		stringCode[i] = Character.toString((char)0xe12e); ++i;
		stringCode[i] = Character.toString((char)0xe12f); ++i;
		stringCode[i] = Character.toString((char)0xe013); ++i;
		stringCode[i] = Character.toString((char)0xe13a); ++i;
		stringCode[i] = Character.toString((char)0xe13b); ++i;
		stringCode[i] = Character.toString((char)0xe13c); ++i;
		stringCode[i] = Character.toString((char)0xe13d); ++i;
		stringCode[i] = Character.toString((char)0xe13e); ++i;
		stringCode[i] = Character.toString((char)0xe13f); ++i;
		stringCode[i] = Character.toString((char)0xe014); ++i;
		stringCode[i] = Character.toString((char)0xe14a); ++i;
		stringCode[i] = Character.toString((char)0xe14b); ++i;
		stringCode[i] = Character.toString((char)0xe14c); ++i;
		stringCode[i] = Character.toString((char)0xe14d); ++i;
		stringCode[i] = Character.toString((char)0xe14e); ++i;
		stringCode[i] = Character.toString((char)0xe14f); ++i;
		stringCode[i] = Character.toString((char)0xe015); ++i;
		stringCode[i] = Character.toString((char)0xe15a); ++i;
		stringCode[i] = Character.toString((char)0xe016); ++i;
		stringCode[i] = Character.toString((char)0xe017); ++i;
		stringCode[i] = Character.toString((char)0xe018); ++i;
		stringCode[i] = Character.toString((char)0xe019); ++i;
		stringCode[i] = Character.toString((char)0xe020); ++i;
		stringCode[i] = Character.toString((char)0xe20a); ++i;
		stringCode[i] = Character.toString((char)0xe20b); ++i;
		stringCode[i] = Character.toString((char)0xe20c); ++i;
		stringCode[i] = Character.toString((char)0xe20d); ++i;
		stringCode[i] = Character.toString((char)0xe20e); ++i;
		stringCode[i] = Character.toString((char)0xe20f); ++i;
		stringCode[i] = Character.toString((char)0xe021); ++i;
		stringCode[i] = Character.toString((char)0xe21a); ++i;
		stringCode[i] = Character.toString((char)0xe21b); ++i;
		stringCode[i] = Character.toString((char)0xe21c); ++i;
		stringCode[i] = Character.toString((char)0xe21d); ++i;
		stringCode[i] = Character.toString((char)0xe21e); ++i;
		stringCode[i] = Character.toString((char)0xe21f); ++i;
		stringCode[i] = Character.toString((char)0xe022); ++i;
		stringCode[i] = Character.toString((char)0xe22a); ++i;
		stringCode[i] = Character.toString((char)0xe22b); ++i;
		stringCode[i] = Character.toString((char)0xe22c); ++i;
		stringCode[i] = Character.toString((char)0xe22d); ++i;
		stringCode[i] = Character.toString((char)0xe22e); ++i;
		stringCode[i] = Character.toString((char)0xe22f); ++i;
		stringCode[i] = Character.toString((char)0xe023); ++i;
		stringCode[i] = Character.toString((char)0xe23a); ++i;
		stringCode[i] = Character.toString((char)0xe23b); ++i;
		stringCode[i] = Character.toString((char)0xe23c); ++i;
		stringCode[i] = Character.toString((char)0xe23d); ++i;
		stringCode[i] = Character.toString((char)0xe23e); ++i;
		stringCode[i] = Character.toString((char)0xe23f); ++i;
		stringCode[i] = Character.toString((char)0xe024); ++i;
		stringCode[i] = Character.toString((char)0xe24a); ++i;
		stringCode[i] = Character.toString((char)0xe24b); ++i;
		stringCode[i] = Character.toString((char)0xe24c); ++i;
		stringCode[i] = Character.toString((char)0xe24d); ++i;
		stringCode[i] = Character.toString((char)0xe24e); ++i;
		stringCode[i] = Character.toString((char)0xe24f); ++i;
		stringCode[i] = Character.toString((char)0xe025); ++i;
		stringCode[i] = Character.toString((char)0xe026); ++i;
		stringCode[i] = Character.toString((char)0xe027); ++i;
		stringCode[i] = Character.toString((char)0xe028); ++i;
		stringCode[i] = Character.toString((char)0xe029); ++i;
		stringCode[i] = Character.toString((char)0xe030); ++i;
		stringCode[i] = Character.toString((char)0xe30a); ++i;
		stringCode[i] = Character.toString((char)0xe30b); ++i;
		stringCode[i] = Character.toString((char)0xe30c); ++i;
		stringCode[i] = Character.toString((char)0xe30d); ++i;
		stringCode[i] = Character.toString((char)0xe30e); ++i;
		stringCode[i] = Character.toString((char)0xe30f); ++i;
		stringCode[i] = Character.toString((char)0xe031); ++i;
		stringCode[i] = Character.toString((char)0xe31a); ++i;
		stringCode[i] = Character.toString((char)0xe31b); ++i;
		stringCode[i] = Character.toString((char)0xe31c); ++i;
		stringCode[i] = Character.toString((char)0xe31d); ++i;
		stringCode[i] = Character.toString((char)0xe31e); ++i;
		stringCode[i] = Character.toString((char)0xe31f); ++i;
		stringCode[i] = Character.toString((char)0xe032); ++i;
		stringCode[i] = Character.toString((char)0xe32a); ++i;
		stringCode[i] = Character.toString((char)0xe32b); ++i;
		stringCode[i] = Character.toString((char)0xe32c); ++i;
		stringCode[i] = Character.toString((char)0xe32d); ++i;
		stringCode[i] = Character.toString((char)0xe32e); ++i;
		stringCode[i] = Character.toString((char)0xe32f); ++i;
		stringCode[i] = Character.toString((char)0xe033); ++i;
		stringCode[i] = Character.toString((char)0xe33a); ++i;
		stringCode[i] = Character.toString((char)0xe33b); ++i;
		stringCode[i] = Character.toString((char)0xe33c); ++i;
		stringCode[i] = Character.toString((char)0xe33d); ++i;
		stringCode[i] = Character.toString((char)0xe33e); ++i;
		stringCode[i] = Character.toString((char)0xe33f); ++i;
		stringCode[i] = Character.toString((char)0xe034); ++i;
		stringCode[i] = Character.toString((char)0xe34a); ++i;
		stringCode[i] = Character.toString((char)0xe34b); ++i;
		stringCode[i] = Character.toString((char)0xe34c); ++i;
		stringCode[i] = Character.toString((char)0xe34d); ++i;
		stringCode[i] = Character.toString((char)0xe035); ++i;
		stringCode[i] = Character.toString((char)0xe036); ++i;
		stringCode[i] = Character.toString((char)0xe037); ++i;
		stringCode[i] = Character.toString((char)0xe038); ++i;
		stringCode[i] = Character.toString((char)0xe039); ++i;
		stringCode[i] = Character.toString((char)0xe040); ++i;
		stringCode[i] = Character.toString((char)0xe40a); ++i;
		stringCode[i] = Character.toString((char)0xe40b); ++i;
		stringCode[i] = Character.toString((char)0xe40c); ++i;
		stringCode[i] = Character.toString((char)0xe40d); ++i;
		stringCode[i] = Character.toString((char)0xe40e); ++i;
		stringCode[i] = Character.toString((char)0xe40f); ++i;
		stringCode[i] = Character.toString((char)0xe041); ++i;
		stringCode[i] = Character.toString((char)0xe41a); ++i;
		stringCode[i] = Character.toString((char)0xe41b); ++i;
		stringCode[i] = Character.toString((char)0xe41c); ++i;
		stringCode[i] = Character.toString((char)0xe41d); ++i;
		stringCode[i] = Character.toString((char)0xe41e); ++i;
		stringCode[i] = Character.toString((char)0xe41f); ++i;
		stringCode[i] = Character.toString((char)0xe042); ++i;
		stringCode[i] = Character.toString((char)0xe42a); ++i;
		stringCode[i] = Character.toString((char)0xe42b); ++i;
		stringCode[i] = Character.toString((char)0xe42c); ++i;
		stringCode[i] = Character.toString((char)0xe42d); ++i;
		stringCode[i] = Character.toString((char)0xe42e); ++i;
		stringCode[i] = Character.toString((char)0xe42f); ++i;
		stringCode[i] = Character.toString((char)0xe043); ++i;
		stringCode[i] = Character.toString((char)0xe43a); ++i;
		stringCode[i] = Character.toString((char)0xe43b); ++i;
		stringCode[i] = Character.toString((char)0xe43c); ++i;
		stringCode[i] = Character.toString((char)0xe43d); ++i;
		stringCode[i] = Character.toString((char)0xe43e); ++i;
		stringCode[i] = Character.toString((char)0xe43f); ++i;
		stringCode[i] = Character.toString((char)0xe044); ++i;
		stringCode[i] = Character.toString((char)0xe44a); ++i;
		stringCode[i] = Character.toString((char)0xe44b); ++i;
		stringCode[i] = Character.toString((char)0xe44c); ++i;
		stringCode[i] = Character.toString((char)0xe045); ++i;
		stringCode[i] = Character.toString((char)0xe046); ++i;
		stringCode[i] = Character.toString((char)0xe047); ++i;
		stringCode[i] = Character.toString((char)0xe048); ++i;
		stringCode[i] = Character.toString((char)0xe049); ++i;
		stringCode[i] = Character.toString((char)0xe050); ++i;
		stringCode[i] = Character.toString((char)0xe50a); ++i;
		stringCode[i] = Character.toString((char)0xe50b); ++i;
		stringCode[i] = Character.toString((char)0xe50c); ++i;
		stringCode[i] = Character.toString((char)0xe50d); ++i;
		stringCode[i] = Character.toString((char)0xe50e); ++i;
		stringCode[i] = Character.toString((char)0xe50f); ++i;
		stringCode[i] = Character.toString((char)0xe051); ++i;
		stringCode[i] = Character.toString((char)0xe51a); ++i;
		stringCode[i] = Character.toString((char)0xe51b); ++i;
		stringCode[i] = Character.toString((char)0xe51c); ++i;
		stringCode[i] = Character.toString((char)0xe51d); ++i;
		stringCode[i] = Character.toString((char)0xe51e); ++i;
		stringCode[i] = Character.toString((char)0xe51f); ++i;
		stringCode[i] = Character.toString((char)0xe052); ++i;
		stringCode[i] = Character.toString((char)0xe52a); ++i;
		stringCode[i] = Character.toString((char)0xe52b); ++i;
		stringCode[i] = Character.toString((char)0xe52c); ++i;
		stringCode[i] = Character.toString((char)0xe52d); ++i;
		stringCode[i] = Character.toString((char)0xe52e); ++i;
		stringCode[i] = Character.toString((char)0xe52f); ++i;
		stringCode[i] = Character.toString((char)0xe053); ++i;
		stringCode[i] = Character.toString((char)0xe054); ++i;
		stringCode[i] = Character.toString((char)0xe055); ++i;
		stringCode[i] = Character.toString((char)0xe056); ++i;
		stringCode[i] = Character.toString((char)0xe057); ++i;
		stringCode[i] = Character.toString((char)0xe058); ++i;
		stringCode[i] = Character.toString((char)0xe059); ++i;
		stringCode[i] = Character.toString((char)0xe101); ++i;
		stringCode[i] = Character.toString((char)0xe102); ++i;
		stringCode[i] = Character.toString((char)0xe103); ++i;
		stringCode[i] = Character.toString((char)0xe104); ++i;
		stringCode[i] = Character.toString((char)0xe105); ++i;
		stringCode[i] = Character.toString((char)0xe106); ++i;
		stringCode[i] = Character.toString((char)0xe107); ++i;
		stringCode[i] = Character.toString((char)0xe108); ++i;
		stringCode[i] = Character.toString((char)0xe109); ++i;
		stringCode[i] = Character.toString((char)0xe110); ++i;
		stringCode[i] = Character.toString((char)0xe111); ++i;
		stringCode[i] = Character.toString((char)0xe112); ++i;
		stringCode[i] = Character.toString((char)0xe113); ++i;
		stringCode[i] = Character.toString((char)0xe114); ++i;
		stringCode[i] = Character.toString((char)0xe115); ++i;
		stringCode[i] = Character.toString((char)0xe116); ++i;
		stringCode[i] = Character.toString((char)0xe117); ++i;
		stringCode[i] = Character.toString((char)0xe118); ++i;
		stringCode[i] = Character.toString((char)0xe119); ++i;
		stringCode[i] = Character.toString((char)0xe120); ++i;
		stringCode[i] = Character.toString((char)0xe121); ++i;
		stringCode[i] = Character.toString((char)0xe122); ++i;
		stringCode[i] = Character.toString((char)0xe123); ++i;
		stringCode[i] = Character.toString((char)0xe124); ++i;
		stringCode[i] = Character.toString((char)0xe125); ++i;
		stringCode[i] = Character.toString((char)0xe126); ++i;
		stringCode[i] = Character.toString((char)0xe127); ++i;
		stringCode[i] = Character.toString((char)0xe128); ++i;
		stringCode[i] = Character.toString((char)0xe129); ++i;
		stringCode[i] = Character.toString((char)0xe130); ++i;
		stringCode[i] = Character.toString((char)0xe131); ++i;
		stringCode[i] = Character.toString((char)0xe132); ++i;
		stringCode[i] = Character.toString((char)0xe133); ++i;
		stringCode[i] = Character.toString((char)0xe134); ++i;
		stringCode[i] = Character.toString((char)0xe135); ++i;
		stringCode[i] = Character.toString((char)0xe136); ++i;
		stringCode[i] = Character.toString((char)0xe137); ++i;
		stringCode[i] = Character.toString((char)0xe138); ++i;
		stringCode[i] = Character.toString((char)0xe139); ++i;
		stringCode[i] = Character.toString((char)0xe140); ++i;
		stringCode[i] = Character.toString((char)0xe141); ++i;
		stringCode[i] = Character.toString((char)0xe142); ++i;
		stringCode[i] = Character.toString((char)0xe143); ++i;
		stringCode[i] = Character.toString((char)0xe144); ++i;
		stringCode[i] = Character.toString((char)0xe145); ++i;
		stringCode[i] = Character.toString((char)0xe146); ++i;
		stringCode[i] = Character.toString((char)0xe147); ++i;
		stringCode[i] = Character.toString((char)0xe148); ++i;
		stringCode[i] = Character.toString((char)0xe149); ++i;
		stringCode[i] = Character.toString((char)0xe150); ++i;
		stringCode[i] = Character.toString((char)0xe151); ++i;
		stringCode[i] = Character.toString((char)0xe152); ++i;
		stringCode[i] = Character.toString((char)0xe153); ++i;
		stringCode[i] = Character.toString((char)0xe154); ++i;
		stringCode[i] = Character.toString((char)0xe155); ++i;
		stringCode[i] = Character.toString((char)0xe156); ++i;
		stringCode[i] = Character.toString((char)0xe157); ++i;
		stringCode[i] = Character.toString((char)0xe158); ++i;
		stringCode[i] = Character.toString((char)0xe159); ++i;
		stringCode[i] = Character.toString((char)0xe201); ++i;
		stringCode[i] = Character.toString((char)0xe202); ++i;
		stringCode[i] = Character.toString((char)0xe203); ++i;
		stringCode[i] = Character.toString((char)0xe204); ++i;
		stringCode[i] = Character.toString((char)0xe205); ++i;
		stringCode[i] = Character.toString((char)0xe206); ++i;
		stringCode[i] = Character.toString((char)0xe207); ++i;
		stringCode[i] = Character.toString((char)0xe208); ++i;
		stringCode[i] = Character.toString((char)0xe209); ++i;
		stringCode[i] = Character.toString((char)0xe210); ++i;
		stringCode[i] = Character.toString((char)0xe211); ++i;
		stringCode[i] = Character.toString((char)0xe212); ++i;
		stringCode[i] = Character.toString((char)0xe213); ++i;
		stringCode[i] = Character.toString((char)0xe214); ++i;
		stringCode[i] = Character.toString((char)0xe215); ++i;
		stringCode[i] = Character.toString((char)0xe216); ++i;
		stringCode[i] = Character.toString((char)0xe217); ++i;
		stringCode[i] = Character.toString((char)0xe218); ++i;
		stringCode[i] = Character.toString((char)0xe219); ++i;
		stringCode[i] = Character.toString((char)0xe220); ++i;
		stringCode[i] = Character.toString((char)0xe221); ++i;
		stringCode[i] = Character.toString((char)0xe222); ++i;
		stringCode[i] = Character.toString((char)0xe223); ++i;
		stringCode[i] = Character.toString((char)0xe224); ++i;
		stringCode[i] = Character.toString((char)0xe225); ++i;
		stringCode[i] = Character.toString((char)0xe226); ++i;
		stringCode[i] = Character.toString((char)0xe227); ++i;
		stringCode[i] = Character.toString((char)0xe228); ++i;
		stringCode[i] = Character.toString((char)0xe229); ++i;
		stringCode[i] = Character.toString((char)0xe230); ++i;
		stringCode[i] = Character.toString((char)0xe231); ++i;
		stringCode[i] = Character.toString((char)0xe232); ++i;
		stringCode[i] = Character.toString((char)0xe233); ++i;
		stringCode[i] = Character.toString((char)0xe234); ++i;
		stringCode[i] = Character.toString((char)0xe235); ++i;
		stringCode[i] = Character.toString((char)0xe236); ++i;
		stringCode[i] = Character.toString((char)0xe237); ++i;
		stringCode[i] = Character.toString((char)0xe238); ++i;
		stringCode[i] = Character.toString((char)0xe239); ++i;
		stringCode[i] = Character.toString((char)0xe240); ++i;
		stringCode[i] = Character.toString((char)0xe241); ++i;
		stringCode[i] = Character.toString((char)0xe242); ++i;
		stringCode[i] = Character.toString((char)0xe243); ++i;
		stringCode[i] = Character.toString((char)0xe244); ++i;
		stringCode[i] = Character.toString((char)0xe245); ++i;
		stringCode[i] = Character.toString((char)0xe246); ++i;
		stringCode[i] = Character.toString((char)0xe247); ++i;
		stringCode[i] = Character.toString((char)0xe248); ++i;
		stringCode[i] = Character.toString((char)0xe249); ++i;
		stringCode[i] = Character.toString((char)0xe250); ++i;
		stringCode[i] = Character.toString((char)0xe251); ++i;
		stringCode[i] = Character.toString((char)0xe252); ++i;
		stringCode[i] = Character.toString((char)0xe253); ++i;
		stringCode[i] = Character.toString((char)0xe301); ++i;
		stringCode[i] = Character.toString((char)0xe302); ++i;
		stringCode[i] = Character.toString((char)0xe303); ++i;
		stringCode[i] = Character.toString((char)0xe304); ++i;
		stringCode[i] = Character.toString((char)0xe305); ++i;
		stringCode[i] = Character.toString((char)0xe306); ++i;
		stringCode[i] = Character.toString((char)0xe307); ++i;
		stringCode[i] = Character.toString((char)0xe308); ++i;
		stringCode[i] = Character.toString((char)0xe309); ++i;
		stringCode[i] = Character.toString((char)0xe310); ++i;
		stringCode[i] = Character.toString((char)0xe311); ++i;
		stringCode[i] = Character.toString((char)0xe312); ++i;
		stringCode[i] = Character.toString((char)0xe313); ++i;
		stringCode[i] = Character.toString((char)0xe314); ++i;
		stringCode[i] = Character.toString((char)0xe315); ++i;
		stringCode[i] = Character.toString((char)0xe316); ++i;
		stringCode[i] = Character.toString((char)0xe317); ++i;
		stringCode[i] = Character.toString((char)0xe318); ++i;
		stringCode[i] = Character.toString((char)0xe319); ++i;
		stringCode[i] = Character.toString((char)0xe320); ++i;
		stringCode[i] = Character.toString((char)0xe321); ++i;
		stringCode[i] = Character.toString((char)0xe322); ++i;
		stringCode[i] = Character.toString((char)0xe323); ++i;
		stringCode[i] = Character.toString((char)0xe324); ++i;
		stringCode[i] = Character.toString((char)0xe325); ++i;
		stringCode[i] = Character.toString((char)0xe326); ++i;
		stringCode[i] = Character.toString((char)0xe327); ++i;
		stringCode[i] = Character.toString((char)0xe328); ++i;
		stringCode[i] = Character.toString((char)0xe329); ++i;
		stringCode[i] = Character.toString((char)0xe330); ++i;
		stringCode[i] = Character.toString((char)0xe331); ++i;
		stringCode[i] = Character.toString((char)0xe332); ++i;
		stringCode[i] = Character.toString((char)0xe333); ++i;
		stringCode[i] = Character.toString((char)0xe334); ++i;
		stringCode[i] = Character.toString((char)0xe335); ++i;
		stringCode[i] = Character.toString((char)0xe336); ++i;
		stringCode[i] = Character.toString((char)0xe337); ++i;
		stringCode[i] = Character.toString((char)0xe338); ++i;
		stringCode[i] = Character.toString((char)0xe339); ++i;
		stringCode[i] = Character.toString((char)0xe340); ++i;
		stringCode[i] = Character.toString((char)0xe341); ++i;
		stringCode[i] = Character.toString((char)0xe342); ++i;
		stringCode[i] = Character.toString((char)0xe343); ++i;
		stringCode[i] = Character.toString((char)0xe344); ++i;
		stringCode[i] = Character.toString((char)0xe345); ++i;
		stringCode[i] = Character.toString((char)0xe346); ++i;
		stringCode[i] = Character.toString((char)0xe347); ++i;
		stringCode[i] = Character.toString((char)0xe348); ++i;
		stringCode[i] = Character.toString((char)0xe349); ++i;
		stringCode[i] = Character.toString((char)0xe401); ++i;
		stringCode[i] = Character.toString((char)0xe402); ++i;
		stringCode[i] = Character.toString((char)0xe403); ++i;
		stringCode[i] = Character.toString((char)0xe404); ++i;
		stringCode[i] = Character.toString((char)0xe405); ++i;
		stringCode[i] = Character.toString((char)0xe406); ++i;
		stringCode[i] = Character.toString((char)0xe407); ++i;
		stringCode[i] = Character.toString((char)0xe408); ++i;
		stringCode[i] = Character.toString((char)0xe409); ++i;
		stringCode[i] = Character.toString((char)0xe410); ++i;
		stringCode[i] = Character.toString((char)0xe411); ++i;
		stringCode[i] = Character.toString((char)0xe412); ++i;
		stringCode[i] = Character.toString((char)0xe413); ++i;
		stringCode[i] = Character.toString((char)0xe414); ++i;
		stringCode[i] = Character.toString((char)0xe415); ++i;
		stringCode[i] = Character.toString((char)0xe416); ++i;
		stringCode[i] = Character.toString((char)0xe417); ++i;
		stringCode[i] = Character.toString((char)0xe418); ++i;
		stringCode[i] = Character.toString((char)0xe419); ++i;
		stringCode[i] = Character.toString((char)0xe420); ++i;
		stringCode[i] = Character.toString((char)0xe421); ++i;
		stringCode[i] = Character.toString((char)0xe422); ++i;
		stringCode[i] = Character.toString((char)0xe423); ++i;
		stringCode[i] = Character.toString((char)0xe424); ++i;
		stringCode[i] = Character.toString((char)0xe425); ++i;
		stringCode[i] = Character.toString((char)0xe426); ++i;
		stringCode[i] = Character.toString((char)0xe427); ++i;
		stringCode[i] = Character.toString((char)0xe428); ++i;
		stringCode[i] = Character.toString((char)0xe429); ++i;
		stringCode[i] = Character.toString((char)0xe430); ++i;
		stringCode[i] = Character.toString((char)0xe431); ++i;
		stringCode[i] = Character.toString((char)0xe432); ++i;
		stringCode[i] = Character.toString((char)0xe433); ++i;
		stringCode[i] = Character.toString((char)0xe434); ++i;
		stringCode[i] = Character.toString((char)0xe435); ++i;
		stringCode[i] = Character.toString((char)0xe436); ++i;
		stringCode[i] = Character.toString((char)0xe437); ++i;
		stringCode[i] = Character.toString((char)0xe438); ++i;
		stringCode[i] = Character.toString((char)0xe439); ++i;
		stringCode[i] = Character.toString((char)0xe440); ++i;
		stringCode[i] = Character.toString((char)0xe441); ++i;
		stringCode[i] = Character.toString((char)0xe442); ++i;
		stringCode[i] = Character.toString((char)0xe443); ++i;
		stringCode[i] = Character.toString((char)0xe444); ++i;
		stringCode[i] = Character.toString((char)0xe445); ++i;
		stringCode[i] = Character.toString((char)0xe446); ++i;
		stringCode[i] = Character.toString((char)0xe447); ++i;
		stringCode[i] = Character.toString((char)0xe448); ++i;
		stringCode[i] = Character.toString((char)0xe449); ++i;
		stringCode[i] = Character.toString((char)0xe501); ++i;
		stringCode[i] = Character.toString((char)0xe502); ++i;
		stringCode[i] = Character.toString((char)0xe503); ++i;
		stringCode[i] = Character.toString((char)0xe504); ++i;
		stringCode[i] = Character.toString((char)0xe505); ++i;
		stringCode[i] = Character.toString((char)0xe506); ++i;
		stringCode[i] = Character.toString((char)0xe507); ++i;
		stringCode[i] = Character.toString((char)0xe508); ++i;
		stringCode[i] = Character.toString((char)0xe509); ++i;
		stringCode[i] = Character.toString((char)0xe510); ++i;
		stringCode[i] = Character.toString((char)0xe511); ++i;
		stringCode[i] = Character.toString((char)0xe512); ++i;
		stringCode[i] = Character.toString((char)0xe513); ++i;
		stringCode[i] = Character.toString((char)0xe514); ++i;
		stringCode[i] = Character.toString((char)0xe515); ++i;
		stringCode[i] = Character.toString((char)0xe516); ++i;
		stringCode[i] = Character.toString((char)0xe517); ++i;
		stringCode[i] = Character.toString((char)0xe518); ++i;
		stringCode[i] = Character.toString((char)0xe519); ++i;
		stringCode[i] = Character.toString((char)0xe520); ++i;
		stringCode[i] = Character.toString((char)0xe521); ++i;
		stringCode[i] = Character.toString((char)0xe522); ++i;
		stringCode[i] = Character.toString((char)0xe523); ++i;
		stringCode[i] = Character.toString((char)0xe524); ++i;
		stringCode[i] = Character.toString((char)0xe525); ++i;
		stringCode[i] = Character.toString((char)0xe526); ++i;
		stringCode[i] = Character.toString((char)0xe527); ++i;
		stringCode[i] = Character.toString((char)0xe528); ++i;
		stringCode[i] = Character.toString((char)0xe529); ++i;
		stringCode[i] = Character.toString((char)0xe530); ++i;
		stringCode[i] = Character.toString((char)0xe531); ++i;
		stringCode[i] = Character.toString((char)0xe532); ++i;
		stringCode[i] = Character.toString((char)0xe533); ++i;
		stringCode[i] = Character.toString((char)0xe534); ++i;
		stringCode[i] = Character.toString((char)0xe535); ++i;
		stringCode[i] = Character.toString((char)0xe536); ++i;
		stringCode[i] = Character.toString((char)0xe537); ++i;
	}

	private static void initResCodeIphone() {
		int i=0;
		resCode = new int[471];

		resCode[i] = R.drawable.emoticon_e00a; ++i;
		resCode[i] = R.drawable.emoticon_e00b; ++i;
		resCode[i] = R.drawable.emoticon_e00c; ++i;
		resCode[i] = R.drawable.emoticon_e00d; ++i;
		resCode[i] = R.drawable.emoticon_e00e; ++i;
		resCode[i] = R.drawable.emoticon_e00f; ++i;
		resCode[i] = R.drawable.emoticon_e001; ++i;
		resCode[i] = R.drawable.emoticon_e01a; ++i;
		resCode[i] = R.drawable.emoticon_e01b; ++i;
		resCode[i] = R.drawable.emoticon_e01c; ++i;
		resCode[i] = R.drawable.emoticon_e01d; ++i;
		resCode[i] = R.drawable.emoticon_e01e; ++i;
		resCode[i] = R.drawable.emoticon_e01f; ++i;
		resCode[i] = R.drawable.emoticon_e002; ++i;
		resCode[i] = R.drawable.emoticon_e02a; ++i;
		resCode[i] = R.drawable.emoticon_e02b; ++i;
		resCode[i] = R.drawable.emoticon_e02c; ++i;
		resCode[i] = R.drawable.emoticon_e02d; ++i;
		resCode[i] = R.drawable.emoticon_e02e; ++i;
		resCode[i] = R.drawable.emoticon_e02f; ++i;
		resCode[i] = R.drawable.emoticon_e003; ++i;
		resCode[i] = R.drawable.emoticon_e03a; ++i;
		resCode[i] = R.drawable.emoticon_e03b; ++i;
		resCode[i] = R.drawable.emoticon_e03c; ++i;
		resCode[i] = R.drawable.emoticon_e03d; ++i;
		resCode[i] = R.drawable.emoticon_e03e; ++i;
		resCode[i] = R.drawable.emoticon_e03f; ++i;
		resCode[i] = R.drawable.emoticon_e004; ++i;
		resCode[i] = R.drawable.emoticon_e04a; ++i;
		resCode[i] = R.drawable.emoticon_e04b; ++i;
		resCode[i] = R.drawable.emoticon_e04c; ++i;
		resCode[i] = R.drawable.emoticon_e04d; ++i;
		resCode[i] = R.drawable.emoticon_e04e; ++i;
		resCode[i] = R.drawable.emoticon_e04f; ++i;
		resCode[i] = R.drawable.emoticon_e005; ++i;
		resCode[i] = R.drawable.emoticon_e05a; ++i;
		resCode[i] = R.drawable.emoticon_e006; ++i;
		resCode[i] = R.drawable.emoticon_e007; ++i;
		resCode[i] = R.drawable.emoticon_e008; ++i;
		resCode[i] = R.drawable.emoticon_e009; ++i;
		resCode[i] = R.drawable.emoticon_e010; ++i;
		resCode[i] = R.drawable.emoticon_e10a; ++i;
		resCode[i] = R.drawable.emoticon_e10b; ++i;
		resCode[i] = R.drawable.emoticon_e10c; ++i;
		resCode[i] = R.drawable.emoticon_e10d; ++i;
		resCode[i] = R.drawable.emoticon_e10e; ++i;
		resCode[i] = R.drawable.emoticon_e10f; ++i;
		resCode[i] = R.drawable.emoticon_e011; ++i;
		resCode[i] = R.drawable.emoticon_e11a; ++i;
		resCode[i] = R.drawable.emoticon_e11b; ++i;
		resCode[i] = R.drawable.emoticon_e11c; ++i;
		resCode[i] = R.drawable.emoticon_e11d; ++i;
		resCode[i] = R.drawable.emoticon_e11e; ++i;
		resCode[i] = R.drawable.emoticon_e11f; ++i;
		resCode[i] = R.drawable.emoticon_e012; ++i;
		resCode[i] = R.drawable.emoticon_e12a; ++i;
		resCode[i] = R.drawable.emoticon_e12b; ++i;
		resCode[i] = R.drawable.emoticon_e12c; ++i;
		resCode[i] = R.drawable.emoticon_e12d; ++i;
		resCode[i] = R.drawable.emoticon_e12e; ++i;
		resCode[i] = R.drawable.emoticon_e12f; ++i;
		resCode[i] = R.drawable.emoticon_e013; ++i;
		resCode[i] = R.drawable.emoticon_e13a; ++i;
		resCode[i] = R.drawable.emoticon_e13b; ++i;
		resCode[i] = R.drawable.emoticon_e13c; ++i;
		resCode[i] = R.drawable.emoticon_e13d; ++i;
		resCode[i] = R.drawable.emoticon_e13e; ++i;
		resCode[i] = R.drawable.emoticon_e13f; ++i;
		resCode[i] = R.drawable.emoticon_e014; ++i;
		resCode[i] = R.drawable.emoticon_e14a; ++i;
		resCode[i] = R.drawable.emoticon_e14b; ++i;
		resCode[i] = R.drawable.emoticon_e14c; ++i;
		resCode[i] = R.drawable.emoticon_e14d; ++i;
		resCode[i] = R.drawable.emoticon_e14e; ++i;
		resCode[i] = R.drawable.emoticon_e14f; ++i;
		resCode[i] = R.drawable.emoticon_e015; ++i;
		resCode[i] = R.drawable.emoticon_e15a; ++i;
		resCode[i] = R.drawable.emoticon_e016; ++i;
		resCode[i] = R.drawable.emoticon_e017; ++i;
		resCode[i] = R.drawable.emoticon_e018; ++i;
		resCode[i] = R.drawable.emoticon_e019; ++i;
		resCode[i] = R.drawable.emoticon_e020; ++i;
		resCode[i] = R.drawable.emoticon_e20a; ++i;
		resCode[i] = R.drawable.emoticon_e20b; ++i;
		resCode[i] = R.drawable.emoticon_e20c; ++i;
		resCode[i] = R.drawable.emoticon_e20d; ++i;
		resCode[i] = R.drawable.emoticon_e20e; ++i;
		resCode[i] = R.drawable.emoticon_e20f; ++i;
		resCode[i] = R.drawable.emoticon_e021; ++i;
		resCode[i] = R.drawable.emoticon_e21a; ++i;
		resCode[i] = R.drawable.emoticon_e21b; ++i;
		resCode[i] = R.drawable.emoticon_e21c; ++i;
		resCode[i] = R.drawable.emoticon_e21d; ++i;
		resCode[i] = R.drawable.emoticon_e21e; ++i;
		resCode[i] = R.drawable.emoticon_e21f; ++i;
		resCode[i] = R.drawable.emoticon_e022; ++i;
		resCode[i] = R.drawable.emoticon_e22a; ++i;
		resCode[i] = R.drawable.emoticon_e22b; ++i;
		resCode[i] = R.drawable.emoticon_e22c; ++i;
		resCode[i] = R.drawable.emoticon_e22d; ++i;
		resCode[i] = R.drawable.emoticon_e22e; ++i;
		resCode[i] = R.drawable.emoticon_e22f; ++i;
		resCode[i] = R.drawable.emoticon_e023; ++i;
		resCode[i] = R.drawable.emoticon_e23a; ++i;
		resCode[i] = R.drawable.emoticon_e23b; ++i;
		resCode[i] = R.drawable.emoticon_e23c; ++i;
		resCode[i] = R.drawable.emoticon_e23d; ++i;
		resCode[i] = R.drawable.emoticon_e23e; ++i;
		resCode[i] = R.drawable.emoticon_e23f; ++i;
		resCode[i] = R.drawable.emoticon_e024; ++i;
		resCode[i] = R.drawable.emoticon_e24a; ++i;
		resCode[i] = R.drawable.emoticon_e24b; ++i;
		resCode[i] = R.drawable.emoticon_e24c; ++i;
		resCode[i] = R.drawable.emoticon_e24d; ++i;
		resCode[i] = R.drawable.emoticon_e24e; ++i;
		resCode[i] = R.drawable.emoticon_e24f; ++i;
		resCode[i] = R.drawable.emoticon_e025; ++i;
		resCode[i] = R.drawable.emoticon_e026; ++i;
		resCode[i] = R.drawable.emoticon_e027; ++i;
		resCode[i] = R.drawable.emoticon_e028; ++i;
		resCode[i] = R.drawable.emoticon_e029; ++i;
		resCode[i] = R.drawable.emoticon_e030; ++i;
		resCode[i] = R.drawable.emoticon_e30a; ++i;
		resCode[i] = R.drawable.emoticon_e30b; ++i;
		resCode[i] = R.drawable.emoticon_e30c; ++i;
		resCode[i] = R.drawable.emoticon_e30d; ++i;
		resCode[i] = R.drawable.emoticon_e30e; ++i;
		resCode[i] = R.drawable.emoticon_e30f; ++i;
		resCode[i] = R.drawable.emoticon_e031; ++i;
		resCode[i] = R.drawable.emoticon_e31a; ++i;
		resCode[i] = R.drawable.emoticon_e31b; ++i;
		resCode[i] = R.drawable.emoticon_e31c; ++i;
		resCode[i] = R.drawable.emoticon_e31d; ++i;
		resCode[i] = R.drawable.emoticon_e31e; ++i;
		resCode[i] = R.drawable.emoticon_e31f; ++i;
		resCode[i] = R.drawable.emoticon_e032; ++i;
		resCode[i] = R.drawable.emoticon_e32a; ++i;
		resCode[i] = R.drawable.emoticon_e32b; ++i;
		resCode[i] = R.drawable.emoticon_e32c; ++i;
		resCode[i] = R.drawable.emoticon_e32d; ++i;
		resCode[i] = R.drawable.emoticon_e32e; ++i;
		resCode[i] = R.drawable.emoticon_e32f; ++i;
		resCode[i] = R.drawable.emoticon_e033; ++i;
		resCode[i] = R.drawable.emoticon_e33a; ++i;
		resCode[i] = R.drawable.emoticon_e33b; ++i;
		resCode[i] = R.drawable.emoticon_e33c; ++i;
		resCode[i] = R.drawable.emoticon_e33d; ++i;
		resCode[i] = R.drawable.emoticon_e33e; ++i;
		resCode[i] = R.drawable.emoticon_e33f; ++i;
		resCode[i] = R.drawable.emoticon_e034; ++i;
		resCode[i] = R.drawable.emoticon_e34a; ++i;
		resCode[i] = R.drawable.emoticon_e34b; ++i;
		resCode[i] = R.drawable.emoticon_e34c; ++i;
		resCode[i] = R.drawable.emoticon_e34d; ++i;
		resCode[i] = R.drawable.emoticon_e035; ++i;
		resCode[i] = R.drawable.emoticon_e036; ++i;
		resCode[i] = R.drawable.emoticon_e037; ++i;
		resCode[i] = R.drawable.emoticon_e038; ++i;
		resCode[i] = R.drawable.emoticon_e039; ++i;
		resCode[i] = R.drawable.emoticon_e040; ++i;
		resCode[i] = R.drawable.emoticon_e40a; ++i;
		resCode[i] = R.drawable.emoticon_e40b; ++i;
		resCode[i] = R.drawable.emoticon_e40c; ++i;
		resCode[i] = R.drawable.emoticon_e40d; ++i;
		resCode[i] = R.drawable.emoticon_e40e; ++i;
		resCode[i] = R.drawable.emoticon_e40f; ++i;
		resCode[i] = R.drawable.emoticon_e041; ++i;
		resCode[i] = R.drawable.emoticon_e41a; ++i;
		resCode[i] = R.drawable.emoticon_e41b; ++i;
		resCode[i] = R.drawable.emoticon_e41c; ++i;
		resCode[i] = R.drawable.emoticon_e41d; ++i;
		resCode[i] = R.drawable.emoticon_e41e; ++i;
		resCode[i] = R.drawable.emoticon_e41f; ++i;
		resCode[i] = R.drawable.emoticon_e042; ++i;
		resCode[i] = R.drawable.emoticon_e42a; ++i;
		resCode[i] = R.drawable.emoticon_e42b; ++i;
		resCode[i] = R.drawable.emoticon_e42c; ++i;
		resCode[i] = R.drawable.emoticon_e42d; ++i;
		resCode[i] = R.drawable.emoticon_e42e; ++i;
		resCode[i] = R.drawable.emoticon_e42f; ++i;
		resCode[i] = R.drawable.emoticon_e043; ++i;
		resCode[i] = R.drawable.emoticon_e43a; ++i;
		resCode[i] = R.drawable.emoticon_e43b; ++i;
		resCode[i] = R.drawable.emoticon_e43c; ++i;
		resCode[i] = R.drawable.emoticon_e43d; ++i;
		resCode[i] = R.drawable.emoticon_e43e; ++i;
		resCode[i] = R.drawable.emoticon_e43f; ++i;
		resCode[i] = R.drawable.emoticon_e044; ++i;
		resCode[i] = R.drawable.emoticon_e44a; ++i;
		resCode[i] = R.drawable.emoticon_e44b; ++i;
		resCode[i] = R.drawable.emoticon_e44c; ++i;
		resCode[i] = R.drawable.emoticon_e045; ++i;
		resCode[i] = R.drawable.emoticon_e046; ++i;
		resCode[i] = R.drawable.emoticon_e047; ++i;
		resCode[i] = R.drawable.emoticon_e048; ++i;
		resCode[i] = R.drawable.emoticon_e049; ++i;
		resCode[i] = R.drawable.emoticon_e050; ++i;
		resCode[i] = R.drawable.emoticon_e50a; ++i;
		resCode[i] = R.drawable.emoticon_e50b; ++i;
		resCode[i] = R.drawable.emoticon_e50c; ++i;
		resCode[i] = R.drawable.emoticon_e50d; ++i;
		resCode[i] = R.drawable.emoticon_e50e; ++i;
		resCode[i] = R.drawable.emoticon_e50f; ++i;
		resCode[i] = R.drawable.emoticon_e051; ++i;
		resCode[i] = R.drawable.emoticon_e51a; ++i;
		resCode[i] = R.drawable.emoticon_e51b; ++i;
		resCode[i] = R.drawable.emoticon_e51c; ++i;
		resCode[i] = R.drawable.emoticon_e51d; ++i;
		resCode[i] = R.drawable.emoticon_e51e; ++i;
		resCode[i] = R.drawable.emoticon_e51f; ++i;
		resCode[i] = R.drawable.emoticon_e052; ++i;
		resCode[i] = R.drawable.emoticon_e52a; ++i;
		resCode[i] = R.drawable.emoticon_e52b; ++i;
		resCode[i] = R.drawable.emoticon_e52c; ++i;
		resCode[i] = R.drawable.emoticon_e52d; ++i;
		resCode[i] = R.drawable.emoticon_e52e; ++i;
		resCode[i] = R.drawable.emoticon_e52f; ++i;
		resCode[i] = R.drawable.emoticon_e053; ++i;
		resCode[i] = R.drawable.emoticon_e054; ++i;
		resCode[i] = R.drawable.emoticon_e055; ++i;
		resCode[i] = R.drawable.emoticon_e056; ++i;
		resCode[i] = R.drawable.emoticon_e057; ++i;
		resCode[i] = R.drawable.emoticon_e058; ++i;
		resCode[i] = R.drawable.emoticon_e059; ++i;
		resCode[i] = R.drawable.emoticon_e101; ++i;
		resCode[i] = R.drawable.emoticon_e102; ++i;
		resCode[i] = R.drawable.emoticon_e103; ++i;
		resCode[i] = R.drawable.emoticon_e104; ++i;
		resCode[i] = R.drawable.emoticon_e105; ++i;
		resCode[i] = R.drawable.emoticon_e106; ++i;
		resCode[i] = R.drawable.emoticon_e107; ++i;
		resCode[i] = R.drawable.emoticon_e108; ++i;
		resCode[i] = R.drawable.emoticon_e109; ++i;
		resCode[i] = R.drawable.emoticon_e110; ++i;
		resCode[i] = R.drawable.emoticon_e111; ++i;
		resCode[i] = R.drawable.emoticon_e112; ++i;
		resCode[i] = R.drawable.emoticon_e113; ++i;
		resCode[i] = R.drawable.emoticon_e114; ++i;
		resCode[i] = R.drawable.emoticon_e115; ++i;
		resCode[i] = R.drawable.emoticon_e116; ++i;
		resCode[i] = R.drawable.emoticon_e117; ++i;
		resCode[i] = R.drawable.emoticon_e118; ++i;
		resCode[i] = R.drawable.emoticon_e119; ++i;
		resCode[i] = R.drawable.emoticon_e120; ++i;
		resCode[i] = R.drawable.emoticon_e121; ++i;
		resCode[i] = R.drawable.emoticon_e122; ++i;
		resCode[i] = R.drawable.emoticon_e123; ++i;
		resCode[i] = R.drawable.emoticon_e124; ++i;
		resCode[i] = R.drawable.emoticon_e125; ++i;
		resCode[i] = R.drawable.emoticon_e126; ++i;
		resCode[i] = R.drawable.emoticon_e127; ++i;
		resCode[i] = R.drawable.emoticon_e128; ++i;
		resCode[i] = R.drawable.emoticon_e129; ++i;
		resCode[i] = R.drawable.emoticon_e130; ++i;
		resCode[i] = R.drawable.emoticon_e131; ++i;
		resCode[i] = R.drawable.emoticon_e132; ++i;
		resCode[i] = R.drawable.emoticon_e133; ++i;
		resCode[i] = R.drawable.emoticon_e134; ++i;
		resCode[i] = R.drawable.emoticon_e135; ++i;
		resCode[i] = R.drawable.emoticon_e136; ++i;
		resCode[i] = R.drawable.emoticon_e137; ++i;
		resCode[i] = R.drawable.emoticon_e138; ++i;
		resCode[i] = R.drawable.emoticon_e139; ++i;
		resCode[i] = R.drawable.emoticon_e140; ++i;
		resCode[i] = R.drawable.emoticon_e141; ++i;
		resCode[i] = R.drawable.emoticon_e142; ++i;
		resCode[i] = R.drawable.emoticon_e143; ++i;
		resCode[i] = R.drawable.emoticon_e144; ++i;
		resCode[i] = R.drawable.emoticon_e145; ++i;
		resCode[i] = R.drawable.emoticon_e146; ++i;
		resCode[i] = R.drawable.emoticon_e147; ++i;
		resCode[i] = R.drawable.emoticon_e148; ++i;
		resCode[i] = R.drawable.emoticon_e149; ++i;
		resCode[i] = R.drawable.emoticon_e150; ++i;
		resCode[i] = R.drawable.emoticon_e151; ++i;
		resCode[i] = R.drawable.emoticon_e152; ++i;
		resCode[i] = R.drawable.emoticon_e153; ++i;
		resCode[i] = R.drawable.emoticon_e154; ++i;
		resCode[i] = R.drawable.emoticon_e155; ++i;
		resCode[i] = R.drawable.emoticon_e156; ++i;
		resCode[i] = R.drawable.emoticon_e157; ++i;
		resCode[i] = R.drawable.emoticon_e158; ++i;
		resCode[i] = R.drawable.emoticon_e159; ++i;
		resCode[i] = R.drawable.emoticon_e201; ++i;
		resCode[i] = R.drawable.emoticon_e202; ++i;
		resCode[i] = R.drawable.emoticon_e203; ++i;
		resCode[i] = R.drawable.emoticon_e204; ++i;
		resCode[i] = R.drawable.emoticon_e205; ++i;
		resCode[i] = R.drawable.emoticon_e206; ++i;
		resCode[i] = R.drawable.emoticon_e207; ++i;
		resCode[i] = R.drawable.emoticon_e208; ++i;
		resCode[i] = R.drawable.emoticon_e209; ++i;
		resCode[i] = R.drawable.emoticon_e210; ++i;
		resCode[i] = R.drawable.emoticon_e211; ++i;
		resCode[i] = R.drawable.emoticon_e212; ++i;
		resCode[i] = R.drawable.emoticon_e213; ++i;
		resCode[i] = R.drawable.emoticon_e214; ++i;
		resCode[i] = R.drawable.emoticon_e215; ++i;
		resCode[i] = R.drawable.emoticon_e216; ++i;
		resCode[i] = R.drawable.emoticon_e217; ++i;
		resCode[i] = R.drawable.emoticon_e218; ++i;
		resCode[i] = R.drawable.emoticon_e219; ++i;
		resCode[i] = R.drawable.emoticon_e220; ++i;
		resCode[i] = R.drawable.emoticon_e221; ++i;
		resCode[i] = R.drawable.emoticon_e222; ++i;
		resCode[i] = R.drawable.emoticon_e223; ++i;
		resCode[i] = R.drawable.emoticon_e224; ++i;
		resCode[i] = R.drawable.emoticon_e225; ++i;
		resCode[i] = R.drawable.emoticon_e226; ++i;
		resCode[i] = R.drawable.emoticon_e227; ++i;
		resCode[i] = R.drawable.emoticon_e228; ++i;
		resCode[i] = R.drawable.emoticon_e229; ++i;
		resCode[i] = R.drawable.emoticon_e230; ++i;
		resCode[i] = R.drawable.emoticon_e231; ++i;
		resCode[i] = R.drawable.emoticon_e232; ++i;
		resCode[i] = R.drawable.emoticon_e233; ++i;
		resCode[i] = R.drawable.emoticon_e234; ++i;
		resCode[i] = R.drawable.emoticon_e235; ++i;
		resCode[i] = R.drawable.emoticon_e236; ++i;
		resCode[i] = R.drawable.emoticon_e237; ++i;
		resCode[i] = R.drawable.emoticon_e238; ++i;
		resCode[i] = R.drawable.emoticon_e239; ++i;
		resCode[i] = R.drawable.emoticon_e240; ++i;
		resCode[i] = R.drawable.emoticon_e241; ++i;
		resCode[i] = R.drawable.emoticon_e242; ++i;
		resCode[i] = R.drawable.emoticon_e243; ++i;
		resCode[i] = R.drawable.emoticon_e244; ++i;
		resCode[i] = R.drawable.emoticon_e245; ++i;
		resCode[i] = R.drawable.emoticon_e246; ++i;
		resCode[i] = R.drawable.emoticon_e247; ++i;
		resCode[i] = R.drawable.emoticon_e248; ++i;
		resCode[i] = R.drawable.emoticon_e249; ++i;
		resCode[i] = R.drawable.emoticon_e250; ++i;
		resCode[i] = R.drawable.emoticon_e251; ++i;
		resCode[i] = R.drawable.emoticon_e252; ++i;
		resCode[i] = R.drawable.emoticon_e253; ++i;
		resCode[i] = R.drawable.emoticon_e301; ++i;
		resCode[i] = R.drawable.emoticon_e302; ++i;
		resCode[i] = R.drawable.emoticon_e303; ++i;
		resCode[i] = R.drawable.emoticon_e304; ++i;
		resCode[i] = R.drawable.emoticon_e305; ++i;
		resCode[i] = R.drawable.emoticon_e306; ++i;
		resCode[i] = R.drawable.emoticon_e307; ++i;
		resCode[i] = R.drawable.emoticon_e308; ++i;
		resCode[i] = R.drawable.emoticon_e309; ++i;
		resCode[i] = R.drawable.emoticon_e310; ++i;
		resCode[i] = R.drawable.emoticon_e311; ++i;
		resCode[i] = R.drawable.emoticon_e312; ++i;
		resCode[i] = R.drawable.emoticon_e313; ++i;
		resCode[i] = R.drawable.emoticon_e314; ++i;
		resCode[i] = R.drawable.emoticon_e315; ++i;
		resCode[i] = R.drawable.emoticon_e316; ++i;
		resCode[i] = R.drawable.emoticon_e317; ++i;
		resCode[i] = R.drawable.emoticon_e318; ++i;
		resCode[i] = R.drawable.emoticon_e319; ++i;
		resCode[i] = R.drawable.emoticon_e320; ++i;
		resCode[i] = R.drawable.emoticon_e321; ++i;
		resCode[i] = R.drawable.emoticon_e322; ++i;
		resCode[i] = R.drawable.emoticon_e323; ++i;
		resCode[i] = R.drawable.emoticon_e324; ++i;
		resCode[i] = R.drawable.emoticon_e325; ++i;
		resCode[i] = R.drawable.emoticon_e326; ++i;
		resCode[i] = R.drawable.emoticon_e327; ++i;
		resCode[i] = R.drawable.emoticon_e328; ++i;
		resCode[i] = R.drawable.emoticon_e329; ++i;
		resCode[i] = R.drawable.emoticon_e330; ++i;
		resCode[i] = R.drawable.emoticon_e331; ++i;
		resCode[i] = R.drawable.emoticon_e332; ++i;
		resCode[i] = R.drawable.emoticon_e333; ++i;
		resCode[i] = R.drawable.emoticon_e334; ++i;
		resCode[i] = R.drawable.emoticon_e335; ++i;
		resCode[i] = R.drawable.emoticon_e336; ++i;
		resCode[i] = R.drawable.emoticon_e337; ++i;
		resCode[i] = R.drawable.emoticon_e338; ++i;
		resCode[i] = R.drawable.emoticon_e339; ++i;
		resCode[i] = R.drawable.emoticon_e340; ++i;
		resCode[i] = R.drawable.emoticon_e341; ++i;
		resCode[i] = R.drawable.emoticon_e342; ++i;
		resCode[i] = R.drawable.emoticon_e343; ++i;
		resCode[i] = R.drawable.emoticon_e344; ++i;
		resCode[i] = R.drawable.emoticon_e345; ++i;
		resCode[i] = R.drawable.emoticon_e346; ++i;
		resCode[i] = R.drawable.emoticon_e347; ++i;
		resCode[i] = R.drawable.emoticon_e348; ++i;
		resCode[i] = R.drawable.emoticon_e349; ++i;
		resCode[i] = R.drawable.emoticon_e401; ++i;
		resCode[i] = R.drawable.emoticon_e402; ++i;
		resCode[i] = R.drawable.emoticon_e403; ++i;
		resCode[i] = R.drawable.emoticon_e404; ++i;
		resCode[i] = R.drawable.emoticon_e405; ++i;
		resCode[i] = R.drawable.emoticon_e406; ++i;
		resCode[i] = R.drawable.emoticon_e407; ++i;
		resCode[i] = R.drawable.emoticon_e408; ++i;
		resCode[i] = R.drawable.emoticon_e409; ++i;
		resCode[i] = R.drawable.emoticon_e410; ++i;
		resCode[i] = R.drawable.emoticon_e411; ++i;
		resCode[i] = R.drawable.emoticon_e412; ++i;
		resCode[i] = R.drawable.emoticon_e413; ++i;
		resCode[i] = R.drawable.emoticon_e414; ++i;
		resCode[i] = R.drawable.emoticon_e415; ++i;
		resCode[i] = R.drawable.emoticon_e416; ++i;
		resCode[i] = R.drawable.emoticon_e417; ++i;
		resCode[i] = R.drawable.emoticon_e418; ++i;
		resCode[i] = R.drawable.emoticon_e419; ++i;
		resCode[i] = R.drawable.emoticon_e420; ++i;
		resCode[i] = R.drawable.emoticon_e421; ++i;
		resCode[i] = R.drawable.emoticon_e422; ++i;
		resCode[i] = R.drawable.emoticon_e423; ++i;
		resCode[i] = R.drawable.emoticon_e424; ++i;
		resCode[i] = R.drawable.emoticon_e425; ++i;
		resCode[i] = R.drawable.emoticon_e426; ++i;
		resCode[i] = R.drawable.emoticon_e427; ++i;
		resCode[i] = R.drawable.emoticon_e428; ++i;
		resCode[i] = R.drawable.emoticon_e429; ++i;
		resCode[i] = R.drawable.emoticon_e430; ++i;
		resCode[i] = R.drawable.emoticon_e431; ++i;
		resCode[i] = R.drawable.emoticon_e432; ++i;
		resCode[i] = R.drawable.emoticon_e433; ++i;
		resCode[i] = R.drawable.emoticon_e434; ++i;
		resCode[i] = R.drawable.emoticon_e435; ++i;
		resCode[i] = R.drawable.emoticon_e436; ++i;
		resCode[i] = R.drawable.emoticon_e437; ++i;
		resCode[i] = R.drawable.emoticon_e438; ++i;
		resCode[i] = R.drawable.emoticon_e439; ++i;
		resCode[i] = R.drawable.emoticon_e440; ++i;
		resCode[i] = R.drawable.emoticon_e441; ++i;
		resCode[i] = R.drawable.emoticon_e442; ++i;
		resCode[i] = R.drawable.emoticon_e443; ++i;
		resCode[i] = R.drawable.emoticon_e444; ++i;
		resCode[i] = R.drawable.emoticon_e445; ++i;
		resCode[i] = R.drawable.emoticon_e446; ++i;
		resCode[i] = R.drawable.emoticon_e447; ++i;
		resCode[i] = R.drawable.emoticon_e448; ++i;
		resCode[i] = R.drawable.emoticon_e449; ++i;
		resCode[i] = R.drawable.emoticon_e501; ++i;
		resCode[i] = R.drawable.emoticon_e502; ++i;
		resCode[i] = R.drawable.emoticon_e503; ++i;
		resCode[i] = R.drawable.emoticon_e504; ++i;
		resCode[i] = R.drawable.emoticon_e505; ++i;
		resCode[i] = R.drawable.emoticon_e506; ++i;
		resCode[i] = R.drawable.emoticon_e507; ++i;
		resCode[i] = R.drawable.emoticon_e508; ++i;
		resCode[i] = R.drawable.emoticon_e509; ++i;
		resCode[i] = R.drawable.emoticon_e510; ++i;
		resCode[i] = R.drawable.emoticon_e511; ++i;
		resCode[i] = R.drawable.emoticon_e512; ++i;
		resCode[i] = R.drawable.emoticon_e513; ++i;
		resCode[i] = R.drawable.emoticon_e514; ++i;
		resCode[i] = R.drawable.emoticon_e515; ++i;
		resCode[i] = R.drawable.emoticon_e516; ++i;
		resCode[i] = R.drawable.emoticon_e517; ++i;
		resCode[i] = R.drawable.emoticon_e518; ++i;
		resCode[i] = R.drawable.emoticon_e519; ++i;
		resCode[i] = R.drawable.emoticon_e520; ++i;
		resCode[i] = R.drawable.emoticon_e521; ++i;
		resCode[i] = R.drawable.emoticon_e522; ++i;
		resCode[i] = R.drawable.emoticon_e523; ++i;
		resCode[i] = R.drawable.emoticon_e524; ++i;
		resCode[i] = R.drawable.emoticon_e525; ++i;
		resCode[i] = R.drawable.emoticon_e526; ++i;
		resCode[i] = R.drawable.emoticon_e527; ++i;
		resCode[i] = R.drawable.emoticon_e528; ++i;
		resCode[i] = R.drawable.emoticon_e529; ++i;
		resCode[i] = R.drawable.emoticon_e530; ++i;
		resCode[i] = R.drawable.emoticon_e531; ++i;
		resCode[i] = R.drawable.emoticon_e532; ++i;
		resCode[i] = R.drawable.emoticon_e533; ++i;
		resCode[i] = R.drawable.emoticon_e534; ++i;
		resCode[i] = R.drawable.emoticon_e535; ++i;
		resCode[i] = R.drawable.emoticon_e536; ++i;
		resCode[i] = R.drawable.emoticon_e537; ++i;
	}
	
	protected static int[][] pageTable = {
		{	// page 1/5
			399,	220,	221,	398,	389,	
			229,	402,	401,	163,	160,	
			388,	228,	393,	164,	386,	
			231,	387,	222,	391,	385,	
			165,	161,	390,	397,	395,	
			396,	394,	230,	223,	400,	
			392,	162,	48,	43,	138,	
			136,	139,	363,	137,	95,	
			102,	362,	364,	140,	141,	
			370,	369,	88,	372,	81,	
			371,	64,	365,	366,	361,	
			25,	51,	35,	4,	405,	
			404,	3,	40,	47,	171,	
			54,	406,	100,	101,	313,	
			312,	411,	170,	5,	172,	
			71,	283,	238,	412,	209,	
			413,	408,	407,	335,	410,	
			234,	409,	133,	134,	132,	
			6,	13,	34,	27,	204,	
			452,	451,	448,	449,	450,	
			205,	275,	32,	206,	208,	
			50,	469,	20,	169,	168,	
			403,	167,	
		},
		{	// page 2/5
			28,	29,	195,	194,	30,	
			65,	427,	185,	33,	210,	
			217,	457,	213,	211,	464,	
			196,	460,	203,	42,	212,	
			216,	461,	7,	257,	463,	
			462,	459,	214,	454,	456,	
			215,	219,	458,	41,	232,	
			455,	80,	218,	453,	341,	
			121,	339,	233,	135,	340,	
			338,	241,	431,	242,	342,	
			343,	428,	425,	
		},
		{	// page 3/5
			420,	421,	422,	181,	423,	
			182,	240,	424,	426,	430,	
			429,	49,	432,	142,	235,	
			360,	347,	345,	249,	250,	
			38,	24,	2,	55,	0,	
			1,	39,	351,	252,	264,	
			265,	352,	251,	70,	293,	
			237,	268,	267,	26,	348,	
			239,	46,	227,	226,	224,	
			225,	67,	263,	53,	60,	
			128,	126,	346,	236,	127,	
			63,	175,	174,	79,	77,	
			75,	68,	176,	177,	78,	
			61,	86,	84,	87,	85,	
			254,	56,	253,	58,	359,	
			336,	271,	435,	23,	122,	
			173,	159,	166,	57,	37,	
			129,	66,	130,	36,	337,	
			354,	356,	357,	349,	436,	
			45,	353,	183,	52,	358,	
			131,	149,	154,	191,	373,	
			193,	124,	187,	123,	180,	
			243,	144,	148,	376,	152,	
			379,	377,	146,	147,	375,	
			153,	374,	270,	378,	145,	
			143,	186,	151,	192,	380,	
			381,	383,	382,	150,	384,	
		},
		{	// page 4/5
			155,	280,	157,	276,	278,	
			72,	279,	434,	281,	184,	
			156,	437,	188,	269,	197,	
			438,	439,	245,	441,	442,	
			22,	31,	433,	189,	207,	
			190,	247,	244,	417,	284,	
			258,	9,	10,	44,	259,	
			178,	8,	76,	282,	416,	
			414,	415,	179,	11,	158,	
			419,	12,	248,	21,	73,	
			334,	260,	291,	277,	256,	
			273,	355,	246,	255,	266,	
			198,	447,	446,	199,	200,	
			444,	202,	445,	443,	201,	
		},
		{	// page 5/5
			91,	92,	93,	94,	302,	
			303,	304,	305,	306,	307,	
			292,	314,	315,	317,	316,	
			318,	319,	320,	321,	104,	
			103,	106,	105,	113,	294,	
			112,	295,	296,	440,	285,	
			83,	96,	97,	308,	309,	
			98,	99,	297,	298,	299,	
			300,	310,	274,	261,	262,	
			62,	290,	74,	82,	418,	
			344,	350,	125,	289,	311,	
			288,	287,	286,	59,	332,	
			333,	69,	272,	108,	322,	
			323,	324,	325,	326,	327,	
			328,	329,	330,	331,	110,	
			111,	107,	465,	466,	467,	
			468,	89,	301,	90,	19,	
			109,	116,	117,	118,	119,	
			120,	14,	15,	16,	17,	
			18,	367,	368,	114,	115,	
			470,	
		}
	};

}
